Skip to content

Conversation

@mehul-m-prajapati
Copy link
Collaborator

@mehul-m-prajapati mehul-m-prajapati commented Jul 28, 2025

Summary by CodeRabbit

  • Chores
    • Improved the workflow for unassigning stale issues by basing the unassignment on the date of assignment rather than issue creation.
    • Enhanced logic to only unassign issues if no pull request is linked within 7 days of assignment.
    • Updated the comment posted upon unassignment to clarify the new timeframe and conditions.

@netlify
Copy link

netlify bot commented Jul 28, 2025

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 6ca7542
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/688776e0933cfc00082f3a8c
😎 Deploy Preview https://deploy-preview-142--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 28, 2025

Walkthrough

The workflow for unassigning stale issues was updated to determine staleness based on the time since the latest assignment event rather than issue creation. It fetches timeline events to identify assignment and pull request linkage dates, unassigning issues if no PR is linked within 7 days after assignment. The unassignment comment was revised accordingly.

Changes

Cohort / File(s) Change Summary
Workflow Logic Update
.github/workflows/unassign-stale-issues.yml
Revised logic to use latest assignment event date for staleness, fetch timeline events, check linked PRs within 7 days, update comment text.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

A bunny hopped through workflow code,
Tweaking logic on its road—
Now staleness checks are sharp and keen,
Assignments timed, not just routine.
If no PR hops in, the bunny knows,
To unassign and onward goes!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 301229f and 6ca7542.

📒 Files selected for processing (1)
  • .github/workflows/unassign-stale-issues.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/unassign-stale-issues.yml
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mehul-m-prajapati-patch-3

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
.github/workflows/unassign-stale-issues.yml (3)

49-50: Broaden PR-link detection beyond the connected event

Some issues are linked to PRs via a cross-reference (cross-referenced) rather than the “connected” event (e.g., using “Fixes #123” in the PR body).
Limiting the search to event === 'connected' may yield false negatives and trigger unwarranted unassignments.

-const prLinkedEvent = timeline.find(e => e.event === 'connected');
+const prLinkedEvent = timeline.find(e =>
+  e.event === 'connected' || e.event === 'cross-referenced');

Consider also checking event.source.issue.pull_request to confirm the reference is indeed a PR.


59-60: Guard-rail: treat “exactly 7 days” as within the grace period

The comparison prLinkedAt > assignedAt + 7 days excludes PRs linked exactly at the 7-day mark, which users may perceive as being “on time”.
Switch to >= when computing the unassignment threshold to make the rule inclusive and simpler to explain.

-if (!prLinkedAt || prLinkedAt > new Date(assignedAt.getTime() + daysBeforeUnassign*24*60*60*1000)) {
+if (!prLinkedAt || prLinkedAt >= new Date(assignedAt.getTime() + daysBeforeUnassign*24*60*60*1000)) {

22-38: Potential rate-limit hotspot

For every open, assigned issue you paginate all timeline events.
On large repos this can hit secondary rate limits quickly.
Two optimisations:

  1. Stop paginating once both a relevant assignment and PR-link event have been found.
  2. Switch to a GraphQL query that requests only assigned, unassigned, connected, and cross-referenced events in a single round-trip.

Not urgent, but worth scheduling before repo traffic grows.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61dc8a2 and 60a5834.

📒 Files selected for processing (1)
  • .github/workflows/unassign-stale-issues.yml (2 hunks)

mehul-m-prajapati and others added 2 commits July 28, 2025 06:30
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
.github/workflows/unassign-stale-issues.yml (3)

39-41: Comment wording contradicts the code

The inline comment says “Find the first assignment event date” but the code deliberately takes the latest assignment (.at(-1)).
Update the comment to avoid confusion for future maintainers.


31-37: Potential rate-limit hit when paginating per-issue timelines

listEventsForTimeline is invoked for every open, assigned issue.
On repositories with hundreds of assigned issues this can exceed REST rate limits and slow the workflow.

Consider batching with GraphQL (search/issues, timeline items) or limiting the call set by first filtering issues whose updated_at is older than the 7-day window.


56-58: Minor: avoid recomputing the 7-day threshold in the hot path

The expression creating a new Date inside the inner if allocates once per issue.
Calculate const unassignThreshold = new Date(assignedAt.getTime() + daysBeforeUnassign * 864e5); once and reuse it to make the intent clearer and shave allocations.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60a5834 and 656eb85.

📒 Files selected for processing (1)
  • .github/workflows/unassign-stale-issues.yml (2 hunks)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/unassign-stale-issues.yml (2)

39-41: Update comment to reflect “latest” assignment, not “first”.

The code now correctly selects the last assignment event (.at(-1)), but the inline comment still says “first assignment event date”.
This can easily mislead future maintainers.

-// Find the first assignment event date
+// Find the most recent assignment event date

31-37: Potential rate-limit risk when paging every issue’s full timeline.

listEventsForTimeline is invoked for every open, assigned issue; each call may need several paginated requests.
In repos with hundreds of active issues this easily consumes the REST API rate limit, causing the job to fail midway.

Consider:
• Filtering candidate issues first by since: (e.g. updated:<now-8d) to reduce the set.
• Using the GraphQL API to batch-fetch only assigned/cross-referenced events for multiple issues in one round-trip.

This keeps the job within rate limits while scaling.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 656eb85 and 301229f.

📒 Files selected for processing (1)
  • .github/workflows/unassign-stale-issues.yml (2 hunks)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@mehul-m-prajapati mehul-m-prajapati merged commit 1eba6b9 into main Jul 29, 2025
6 checks passed
@github-actions
Copy link

🎉🎉 Thank you for your contribution! Your PR #142 has been merged! 🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants